package com.syn.vr.control;

import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;

import com.gaoyi.basemodule.baseUtil.DensityUtil;
import com.gaoyi.basemodule.basedialog.BaseFragmentDialog;
import com.syn.vr.constant.BundleKeyName;
import com.syn.vr.databinding.DialogUploadStatusBinding;


public class UploadStatusDialog extends BaseFragmentDialog<DialogUploadStatusBinding> {

    public UploadStatusDialog() {
    }

    public UploadStatusDialog(Context context) {
        super(context);
    }

    public static UploadStatusDialog newInstance(Context context, String title) {
        Bundle args = new Bundle();
        args.putString(BundleKeyName.DATA, title);
        UploadStatusDialog fragment = new UploadStatusDialog(context);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    protected void initView() {
        Bundle bundle = getArguments();
        if (bundle != null) {
            String title = bundle.getString(BundleKeyName.DATA);
            mBinding.tvDialogTitle.setText(title);
        }
        mBinding.ivDialogClose.setOnClickListener((view) -> dismiss());

        new Handler(Looper.getMainLooper()).postDelayed(this::dismiss, 3000);
    }

    @Override
    protected int getWidth() {
        return DensityUtil.dp2px(280);
    }

    @Override
    protected int getHeight() {
        return DensityUtil.dp2px(234);
    }

    @Override
    protected DialogUploadStatusBinding getViewBinding() {
        return DialogUploadStatusBinding.inflate(getLayoutInflater());
    }

    @Override
    protected String getShowTag() {
        return CENTER;
    }
}
